class CityController < ApplicationController
  def index
    @citys = City.where(:parent=>1)
    @second_citys = Array.new
    @three_citys = Array.new
    @citys.each_with_index do |city,index|
      @citys2 = City.where(:parent=>city[:id])
      @second_citys.push(@citys2)
      _citys3 = nil
      @citys2.each_with_index do |city2,index2|
        if _citys3 != nil
          _citys3 = _citys3 + City.where("state>0 and parent ="+city2[:id].to_s)
        else
          _citys3 = City.where("state>0 and parent ="+city2[:id].to_s)
        end
      end
      @three_citys.push(_citys3)
    end
  end

  def accept
  end

  def reject
  end

  def show
    @city = City.find(params[:id])
    cookies[:city_id] = { :value => params[:id], :expires => 30.day.from_now }
    @city_name = @city.name
  end

  def new
  end

  def create
  end

  def destroy
  end
end
